// zlib 进行压缩/解压缩

let zlib = require('zlib'),
fs = require('fs');

let gzip = zlib.createGzip();

let inp = fs.createReadStream('./has.txt')
let out = fs.createWriteStream('has.gz')

inp.pipe(gzip).pipe(out);